local autocmd = vim.api.nvim_create_autocmd
-- local augroup = vim.api.nvim_create_augroup
-- autocmd("TermClose", {
--   pattern = "*lazygit*",
--   desc = "Refresh Neo-Tree filesystem when closing lazygit",
--   group = augroup("neotree_fs_refresh", { clear = true }),
--   callback = function()
--     if package.loaded["neo-tree.sources.manager"] then require("neo-tree.sources.manager").refresh("filesystem") end
--   end,
-- })
autocmd("FileType", { pattern = "json", command = "set filetype=jsonc" })
autocmd("FileType", { pattern = "zsh", command = "set filetype=sh" })

-- autocmd("FileType", {
--   desc = "Auto select virtualenv Nvim open",
--   pattern = "python",
--   callback = function()
--     local util = require "lspconfig/util"
--     local root_files = {
--       ".git",
--       "pyproject.toml",
--       "setup.py",
--       "setup.cfg",
--       "requirements.txt",
--       "Pipfile",
--       "pyrightconfig.json",
--       "main.py",
--       ".neoconf.json",
--     }
--     local venv = util.root_pattern(unpack(root_files))
--     if venv ~= "" then require("venv-selector").retrieve_from_cache() end
--   end,
--   once = true,
-- })
